<template>
    <van-config-provider>
        <router-view />
    </van-config-provider>
</template>

<script setup lang="ts">
    import { useAppStore } from '@/stores';

    const route = useRoute();
    const { locale } = useI18n();
    watch(
        () => route.params.lang,
        () => {
            const lang = route.params.lang === 'en' ? 'en-US' : 'zh-CN';
            locale.value = lang;
            useAppStore().changeLanguage(lang);
        },
        { immediate: true, deep: true },
    );
</script>

<style scoped></style>
